<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w"%>
<%String path=request.getContextPath(); %>
<script src="<%=path%>/plugins/cityselect/jquery.cityselect.js" type="text/javascript"></script>
<script>
function changecontroltype(obj){
	$w.reloadCurrWin(ctx+"/products/ProductPage@addControlsalesShow.page?bean.type="+obj.value);
}
function controlvalok(){
	var reobj=new Object();
	var relist=[];
	var type=$getByName("bean.type",$w.currWin()).val();
	
	$getByName("controlvals",$w.currWin()).each(function(){
		if(this.checked){
			relist.push({val:this.value,text:$(this).parent().prev().text()})
		}
	})
	reobj.type=type;
	reobj.list=relist;
	$w.closeCurrWin(reobj);
}
</script>

<div class="easyui-panel" data-options="doSize:false,layoutH:47,border:false" style="margin:5px">
	<form method="post" action="" class="pageForm">
		<w:hidden bind="bean.type"/>
		<div class="ui-formContent" style="padding:5px 20px 20px 20px;">
			<p>
				<label style="width:80px;text-align:right">控销类型：</label>
				<label><input name="type" type="radio" value="1" <w:equal bind="bean.type" value="1">checked</w:equal> onclick="changecontroltype(this);">客户分组</label>
				<label><input name="type" type="radio" value="2" <w:equal bind="bean.type" value="2">checked</w:equal> onclick="changecontroltype(this);">价格等级</label>
				<label><input name="type" type="radio" value="3" <w:equal bind="bean.type" value="3">checked</w:equal> onclick="changecontroltype(this);">区域控销</label>
			</p>
			<table>
				<tr>
					<td width="80"></td>
					<td>
						<w:equal bind="bean.type" value="1">
						<table cellspacing="1" cellpadding="1" style="background-color:#ddd">
							<tr class="ui-formContent">
								<td align="center" width="50" height="24">ID</td>
								<td align="center" width="180">客户分组</td>
								<td align="center" width="80">选择</td>
							</tr>
							<w:iterate id="info" bind="resultList_">
								<tr class="ui-formContent">
									<td align="center" height="24"><w:write bind="#info.value"/></td>
									<td align="center"><w:write bind="#info.text"/></td>
									<td align="center"><input name="controlvals" type="checkbox" value="<w:write bind="#info.value"/>"></td>
								</tr>
							</w:iterate>
						</table>
						</w:equal>
						<w:equal bind="bean.type" value="2">
						<table cellspacing="1" cellpadding="1" style="background-color:#ddd">
							<tr class="ui-formContent">
								<td align="center" width="50" height="24">ID</td>
								<td align="center" width="180">价格等级</td>
								<td align="center" width="80">选择</td>
							</tr>
							<w:iterate id="info" bind="resultList_">
								<tr class="ui-formContent">
									<td align="center" height="24"><w:write bind="#info.value"/></td>
									<td align="center"><w:write bind="#info.text"/></td>
									<td align="center"><input name="controlvals" type="checkbox" value="<w:write bind="#info.value"/>"></td>
								</tr>
							</w:iterate>
						</table>
						</w:equal>
						<w:equal bind="bean.type" value="3">
							<table cellspacing="1" cellpadding="1" style="background-color:#ddd">
							<tr class="ui-formContent">
								<td align="center" width="50" height="24">ID</td>
								<td align="center" width="180">控销区域</td>
								<td align="center" width="80">选择</td>
							</tr>
							<w:iterate id="info" bind="resultList_">
								<tr class="ui-formContent">
									<td align="center" height="24"><w:write bind="#info.id"/></td>
									<td align="center"><w:write bind="#info.text"/></td>
									<td align="center"><input name="controlvals" type="checkbox" value="<w:write bind="#info.id"/>"></td>
								</tr>
							</w:iterate>
						</table>
						</w:equal>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="ui-buttonBar">
	<a href="javascript:;" class="easyui-linkbutton marginR16" iconCls="icon_save" onclick="controlvalok()">确定</a>
	<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_cancel" onclick="$w.closeCurrWin()">取 消</a>
</div>
